using System;
using System.Collections.Specialized;
using System.Collections.Generic;

namespace Subgurim.Controles.SSM
{

    internal class SubgurimSiteMapConfiguration
    {
        private string _sitemapResponse;
        public string sitemapResponse
        {
            get { return _sitemapResponse; }
            set { _sitemapResponse = value.Replace("~/", ""); }
        }

        private string _dataPath;
        public string dataPath
        {
            get { return _dataPath; }
            set
            {
                _dataPath = value;
                if (!_dataPath.EndsWith("/"))
                    _dataPath += "/";
            }
        }

        private StringCollection _forbiddenPaths = new StringCollection();
        /// <summary>
        /// Lis of forbidden Paths
        /// </summary>
        public StringCollection forbiddenPaths
        {
            get { return _forbiddenPaths; }
            set { _forbiddenPaths = value; }
        }

        private StringCollection _acceptedExtensions = new StringCollection();
        /// <summary>
        /// List of acceptedExtensions
        /// </summary>
        public StringCollection acceptedExtensions
        {
            get { return _acceptedExtensions; }
            set { _acceptedExtensions = value; }
        }

        private List<RewriterRule> _rewriterRules = new List<RewriterRule>();
        /// <summary>
        /// List of rewriter rules
        /// </summary>
        public List<RewriterRule> rewriterRules
        {
            get { return _rewriterRules; }
            set { _rewriterRules = value; }
        }


    }

    public class RewriterRule
    {
        private string _oldPath;
        public string oldPath
        {
            get { return _oldPath; }
            set { _oldPath = value.ToLower(); }
        }

        private string _newPath;

        public string newPath
        {
            get { return _newPath; }
            set { _newPath = value.ToLower(); }
        }

        public RewriterRule() { }

        public RewriterRule(string oldPath, string newPath)
        {
            this.oldPath = oldPath;
            this.newPath = newPath;
        }

    }
}
